*************************************************************************
* PROGRAM :			FH_binscatters.do
* AUTHOR :			James Feigenbaum
* DATE WRITTEN :	30 April 2015
*************************************************************************

/*********************************************
Replication code for binscatter data (Figures 6 and 7) in Feigenbaum and Hall
How Legislators Respond To Localized Economic Shocks: Evidence From Chinese Import Competition
The binscatter data is generated in stata and the final graphs are made in R (see FH_figures.R)
*********************************************/

clear
program drop _all

/*********************************************
Load and prepare data
*********************************************/

use fh_final_analysis, clear

*create binscatter data for graphs
xi: reg x z dem_share i.decade, cluster(state_cluster)
predict fits, xb

binscatter tradescore fits, controls(decade dem_share) savedata(tradescores_for_r) replace
binscatter pro_ft_barrier fits, controls(decade dem_share) savedata(cato_for_r) replace

binscatter tradescore fits, controls(dem_share decade competitive_dist) by(competitive_dist) savedata(tradeint) replace
binscatter pro_ft_barrier fits, controls(dem_share decade competitive_dist) by(competitive_dist) savedata(catoint) replace

clear
